#include "capture.h"
#include "dial.h"
#include "onu_comm.h"

extern thread_pool_t *Tpool;

void* traceroute_task(void* arg)
{

    dial_arg_t dial_arg = {0};
    dial_result_t* dial_result;

    dial_arg.bridge_mode = 0;
    dial_arg.in.tr_arg.opt = OPT_PRO_UDP;
    dial_arg.in.tr_arg.ip = inet_addr("8.8.8.8");
    // dial_arg.in.tr_arg.ip = inet_addr("180.97.33.107");
    dial_arg.in.tr_arg.max_hop = 0;
    dial_arg.in.tr_arg.port = htons(33489);
    dial_arg.in.tr_arg.blocksize = 0;
    dial_result = (dial_result_t*)dial_traceroute(&dial_arg);
    tr_result_print(&dial_result->out.tr_result);
    free(dial_result);

    return NULL;
}

int traceroute_task_init(int argc, char** argv)
{
    thread_pool_add_task(Tpool, traceroute_task, NULL);
    return 0;
}
